package com.zsx.dao;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
import java.io.InputStream;

public class Text {
    SqlSession sqlSession;
    DoTeacher mapper;
    @Before
    public void init(){
        try {
            InputStream is= Resources.getResourceAsStream("mybatis.xml");
            SqlSessionFactory ssf=new SqlSessionFactoryBuilder().build(is);
            sqlSession = ssf.openSession();
            mapper= sqlSession.getMapper(DoTeacher.class);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    @Test
    public void textSelectFromId(){
        System.out.println(mapper.selectFromId(1));
    }
    @After
    public void after(){

    }
}
